package pl.nazaweb.imedproplus.rest;

import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import pl.nazaweb.imedproplus.business.service.DictionaryService;
import pl.nazaweb.imedproplus.rest.pojo.Icd9Pojo;
import pl.nazaweb.imedproplus.rest.pojo.ResponsePojo;

@Stateless
@Path("/json/dictionary/entry")
public class DictionaryEntry {

    @EJB
    private DictionaryService dictionaryService;

    @GET
    @Path("/get")
    @Produces(MediaType.APPLICATION_JSON)
    public ResponsePojo getIcd9List(@QueryParam("dictionary") Long id) {
        ResponsePojo response = new ResponsePojo();
        try {
            response.data = this.dictionaryService.getDictionaryValues(id);
            response.success = true;
        } catch (Exception e) {
            response.success = false;
            response.message = e.getMessage();
        }
        return response;
    }
}
